﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using KBVault.DAL.Entities;
using KBVault.DAL.Repository;
using System.Web.Services;
using KBVault.Web.Infrastructure;

namespace KBVault.Web.Application
{
    public partial class TagOps : Page
    {
        [WebMethod]
        public static string[] GetTags(string term)
        {
            try
            {
                List<Tag> tags = TagRepository.GetSimilarTags(term);
                return tags.Select(t => t.Name).ToArray<string>();
            }
            catch (Exception ex)
            {
                return new string[] { ex.Message };
            }
        }


        protected void Page_Load(object sender, EventArgs e)
        {

        }
    }
}